* calculate mfg share from 1980 Census data

set trace off
set more 1 
capture log close
clear
clear matrix
set mem 2g
set linesize 200
version 9

log using mfgshare.log, replace

insheet using countydata80.csv, clear
rename areakey county
sort county
merge 1:1 county using msanames07
tab _merge
drop if _merge==2
drop _merge

collapse (sum) aagri-apubadm, by(cbsa)

gen mfgshare80 = (anondur+adur)/(aagri+aconst+anondur+adur+atrans+acomm+awhole+aretail+afinan+abusin+aperson+ahealth+aeduc+aothpro+apubadm)

keep mfgshare80 cbsa
sort cbsa
save mfgshare, replace

quietly log close

